<%!

  Copyright (c) Facebook, Inc. and its affiliates.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

%><% > Autogen%>
#pragma once

#include <vector>

#include <thrift/lib/cpp2/gen/module_metadata_h.h>
#include "<%program:include_prefix%><%program:name%>_types.h"
<%#program:thrift_includes%>
#include "<%program:include_prefix%><%program:name%>_metadata.h"
<%/program:thrift_includes%>

<%#program:services%>
<% > common/service_namespace_cpp2_begin %>
class <%service:name%>SvIf;
<% > common/service_namespace_cpp2_end %>
<%/program:services%>

namespace apache {
namespace thrift {
namespace detail {
namespace md {

<%#program:enums%>
<%^program:no_metadata?%>
template <>
class EnumMetadata<<% > common/namespace_cpp2%><%enum:name%>> {
 public:
  static void gen(ThriftMetadata& metadata);
};
<%/program:no_metadata?%>
<%#program:no_metadata?%>
template <>
class EnumMetadata<<% > common/namespace_cpp2%><%enum:name%>>
    : private EmptyMetadata {
 public:
  using EmptyMetadata::gen;
};
<%/program:no_metadata?%>
<%/program:enums%>
<%#program:structs%>
<%^program:no_metadata?%>
template <>
class StructMetadata<<% > common/namespace_cpp2%><%struct:name%>> {
 public:
  static const ::apache::thrift::metadata::ThriftStruct& gen(ThriftMetadata& metadata);
 <%#program:unstructured_annotations_in_metadata?%>
 private:
  static void unstructured_annotations(::apache::thrift::metadata::ThriftStruct& thriftStruct);
 <%/program:unstructured_annotations_in_metadata?%>
};
<%/program:no_metadata?%>
<%#program:no_metadata?%>
template <>
class StructMetadata<<% > common/namespace_cpp2%><%struct:name%>>
    : private EmptyMetadata {
 public:
  using EmptyMetadata::gen;
};
<%/program:no_metadata?%>
<%/program:structs%>
<%#program:structs%>
<%#struct:exception?%>
<%^program:no_metadata?%>
template <>
class ExceptionMetadata<<% > common/namespace_cpp2%><%struct:name%>> {
 public:
  static void gen(ThriftMetadata& metadata);
};
<%/program:no_metadata?%>
<%#program:no_metadata?%>
template <>
class ExceptionMetadata<<% > common/namespace_cpp2%><%struct:name%>>
    : private EmptyMetadata {
 public:
  using EmptyMetadata::gen;
};
<%/program:no_metadata?%>
<%/struct:exception?%>
<%/program:structs%>
<%#program:services%>
<%^program:no_metadata?%>
template <>
class ServiceMetadata<::<% > common/service_namespace_cpp2%>::<%service:name%>SvIf> {
 public:
  static void gen(ThriftServiceMetadataResponse& response);
 private:
  static const ThriftServiceContextRef* genRecurse(ThriftMetadata& metadata, std::vector<ThriftServiceContextRef>& services);

  template <typename T>
  friend class ServiceMetadata;

<%#service:functions%><%^function:starts_interaction?%>
  static void gen_<%function:cpp_name%>(ThriftMetadata& metadata, ThriftService& context);
<%/function:starts_interaction?%><%/service:functions%>
};
<%/program:no_metadata?%>
<%#program:no_metadata?%>
template <>
class ServiceMetadata<::<% > common/service_namespace_cpp2%>::<%service:name%>SvIf>
    : private EmptyServiceMetadata {
 public:
  using EmptyServiceMetadata::gen;

 private:
  using EmptyServiceMetadata::genRecurse;

  template <typename T>
  friend class ServiceMetadata;
};
<%/program:no_metadata?%>
<%/program:services%>
} // namespace md
} // namespace detail
} // namespace thrift
} // namespace apache
